/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-04-28
 * Time:9:09
 */
public class Student {
    private String name;
    private int age;
    private Room room1;
    private Room room2;
    private Course course1;
    private Course course2;

    public Student(String name, int age, Room room1, Room room2,
                   Course course1, Course course2) {
        this.name = name;
        this.age = age;
        this.room1 = room1;
        this.room2 = room2;
        this.course1 = course1;
        this.course2 = course2;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Room getRoom1() {
        return room1;
    }

    public void setRoom1(Room room1) {
        this.room1 = room1;
    }

    public Room getRoom2() {
        return room2;
    }

    public void setRoom2(Room room2) {
        this.room2 = room2;
    }

    public Course getCourse1() {
        return course1;
    }

    public void setCourse1(Course course1) {
        this.course1 = course1;
    }

    public Course getCourse2() {
        return course2;
    }

    public void setCourse2(Course course2) {
        this.course2 = course2;
    }

    public double getAverage(){
        double ave=0;
        ave+=course1.getScore();
        ave+=course2.getScore();
        ave/=2;
        return ave;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ",ave=" + this.getAverage()+
                '}';
    }

    public void show() {
        System.out.println("Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", room1=" + room1.getLocation() +room1.getId()+
                ", room2=" + room2.getLocation() +room2.getId()+
                ", course1=" + course1.getName() +course1.getScore()+
                ", course2=" + course2.getName() +course1.getScore()+
                '}');
    }
}
